<template>
  <div>
    <p>请选择分类</p>
    <select id='prov' v-model="selIndex" v-on:change="selChange">
      <option v-for="(value, index) in list" v-bind:value='value.id' v-bind:key='index' >{{value.title}}</option>
    </select>
    <p>上传图片</p>
    标题：<textarea v-model="introduce">aaa</textarea>
    <p>introduce is {{introduce}}</p>
    <button v-on:click="submit">确定</button>
  </div>
</template>

<script>

  export default {
    data () {
      return {
        list:[],
        selIndex:0,
        introduce:''
      }
    },
    mounted() {
      this.loadData()
    },
    methods:{
      loadData(){

         this.getAxios('boardCategory/pageList').then(res => {
           console.log(rs.length)
           for (var i = 0; i < res.length; i++) {
             var rs = res[i]
             console.log(rs.title)
           }
         });
        this.$axios.get('http://support.miniprogramhacker.cn/test/rest/boardCategory/pageList').then(res => {
          this.list = res.data.data
          console.log(res.data.data)
        })
      },
      loadBoards(categoryId){
        this.$axios.get('http://support.miniprogramhacker.cn/test/rest/billboard/pageList?categoryId='+categoryId).then(res => {
          // alert(categoryId)
          console.log(res.data.data)
        })
      },
      selChange(val){
        var cat = this.list[this.selIndex]
        this.loadBoards(cat.id)
        // alert(this.selIndex)
      }

    }

  }
</script>

<style>
</style>
